<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link href="/static/js/third/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen" />
    <title>SIGN UP</title>
</head>

<body>
<h2>欢迎您！加入群友</h2>

<form class="form-horizontal" role="form" id="reg_form">
    <div class="form-group">
        <label for="account" class="col-sm-2 control-label">帐号名</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="account" name="account" placeholder="电子邮箱或手机号码"/>
        </div>
    </div>
    <div class="form-group">
        <label for="password" class="col-sm-2 control-label">密码</label>
        <div class="col-sm-10">
            <input type="password" class="form-control" id="password"  name="password" placeholder="请输入密码"/>
        </div>
    </div>
    <div class="form-group">
        <label for="name" class="col-sm-2 control-label">呢称</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="name"  name="name" placeholder="请输入密码"/>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="button" id="reg_btn" class="btn btn-default">注册</button>
        </div>
    </div>
</form>
</body>

</html>
<script src="/static/js/third/jquery/jquery-v1.11.js"></script>
<script src="/static/js/third/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/js/third/layer/layer-1.9.3.js"></script>
<script>
    $("#reg_btn").on("click", function () {
        regSave();
    })
    function regSave() {
        $.ajax({
            type: "POST",
            url: "/reg/save",
            data: $("#reg_form").serialize(),
            dataType: "json",
            success: function (data) {
                layer.closeAll();
                if (data.retCode == 'FAIL') {//失败
                    layer.msg(data.msg, {icon: 2});
                } else {//成功
                    layer.msg(data.msg, {icon: 1});
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                layer.closeAll("loading");
                layer.msg("系统正忙,请稍后再试", {icon: 2}, {shade: [0.5, '#000']});
            }
        });
    }

</script>